#!/usr/bin/python3
import os
from flask import Flask
from encrypt_aes import EncryptAES
from alitable import AliTableClient
import oss2
from alibabacloud_docmind_api20220711.client import Client as docmind_api20220711Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_docmind_api20220711 import models as docmind_api20220711_models
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_credentials.client import Client as CredClient


global VERSION
global aes
global hangzhou_internal_oss_bucket
global hangzhou_public_oss_bucket
global shanghai_internal_oss_bucket
global shanghai_public_oss_bucket
global table_client
global docmind_client
global appcode

################################    
####   各种 config 配置
################################    
VERSION = "v1"

# 加密密钥 16位
aes = EncryptAES('Kei.pke.&#!.$ahP','Teh.PQ@.vck.Qha4')

# hangzhou_table_client = AliTableClient("https://pdfconvert.cn-hangzhou.vpc.tablestore.aliyuncs.com","pdfconvert")
table_client = AliTableClient("https://pdfconvert.cn-shanghai.ots.aliyuncs.com","pdfconvert")

# *****************************************
# ****  OSS Config Group 配置组   ****
#
# 填写RAM用户的访问密钥（AccessKey ID和AccessKey Secret）。
accessKeyId = 'LTAI5tRTUEa16q5Qv54TLaWr'
accessKeySecret = 'JWcUzk5acejkT1SzsCViFbKtYT7EmE'
#
# oss某个地域下面的endpoint 
hangzhou_internal_endPoint = "oss-cn-hangzhou-internal.aliyuncs.com"
# oss外部公开访问的endpoint
hangzhou_public_endPoint = "oss-cn-hangzhou.aliyuncs.com"
hangzhou_bucketName = "pdftoconvert"

# shanghai 
shanghai_internal_endPoint = "oss-cn-shanghai-internal.aliyuncs.com"
shanghai_public_endPoint = "oss-cn-shanghai.aliyuncs.com"
shanghai_bucketName = "sh-pdftoconvert"

#
# *****************************************
# 使用代码嵌入的RAM用户的访问密钥配置访问凭证。
oss_auth = oss2.Auth(accessKeyId, accessKeySecret)
# 杭州
hangzhou_internal_oss_bucket = oss2.Bucket(oss_auth, hangzhou_internal_endPoint, hangzhou_bucketName)
hangzhou_public_oss_bucket = oss2.Bucket(oss_auth, hangzhou_public_endPoint, hangzhou_bucketName)
# 上海
shanghai_internal_oss_bucket = oss2.Bucket(oss_auth, shanghai_internal_endPoint, shanghai_bucketName)
shanghai_public_oss_bucket = oss2.Bucket(oss_auth, shanghai_public_endPoint, shanghai_bucketName)


#docmind_client 文档智能处理
config = open_api_models.Config(access_key_id=accessKeyId, access_key_secret=accessKeySecret)
config.endpoint = f'docmind-api.cn-hangzhou.aliyuncs.com'
docmind_client = docmind_api20220711Client(config)

# 度惠 appcode
appcode = "24a31198c0a5444188dbdd1501d82b8f"
